char * err_msg);
#define READ_DB_EXIT_WITH_ERROR(ERROR_MSG) \
- strcpy(err_msg, "error: " ERROR_MSG); \
+ strcpy(err_msg, ERROR_MSG); \
siridb__free(*siridb); \
*siridb = NULL; \
return -1;
if (!qp_is_array(qp_next(unpacker, NULL)) ||
qp_next(unpacker, &qp_schema) != QP_INT64)
{
- sprintf(err_msg, "error: corrupted database file.");
+ sprintf(err_msg, "Corrupted database file.");
return -1;
}
}
else if (qp_schema.via.int64 != SIRIDB_SCHEMA)
{
- sprintf(err_msg, "error: unsupported schema found: %" PRId64,
+ sprintf(err_msg, "Unsupported schema found: %" PRId64,
qp_schema.via.int64);
return -1;
}
*siridb = SIRIDB_new();
if (*siridb == NULL)
{
- sprintf(err_msg, "error: cannot create SiriDB instance");
+ sprintf(err_msg, "Cannot create SiriDB instance.");
return -1;
}
/* set dbpath */
if (((*siridb)->dbpath = strdup(dbpath)) == NULL)
{
- READ_DB_EXIT_WITH_ERROR("cannot set dbpath.")
+ READ_DB_EXIT_WITH_ERROR("Cannot set dbpath.")
}
-
/* read uuid */
if (qp_next(unpacker, &qp_obj) != QP_RAW || qp_obj.len != 16)
{
- READ_DB_EXIT_WITH_ERROR("cannot read uuid.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read uuid.")
}
/* copy uuid */
if (qp_next(unpacker, &qp_obj) != QP_RAW ||
qp_obj.len >= SIRIDB_MAX_DBNAME_LEN)
{
- READ_DB_EXIT_WITH_ERROR("cannot read database name.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read database name.")
}
/* alloc mem for database name */
(*siridb)->dbname = strndup((const char *) qp_obj.via.raw, qp_obj.len);
if ((*siridb)->dbname == NULL)
{
- READ_DB_EXIT_WITH_ERROR("cannot allocate database name.")
+ READ_DB_EXIT_WITH_ERROR("Cannot allocate database name.")
}
/* read time precision */
qp_obj.via.int64 < SIRIDB_TIME_SECONDS ||
qp_obj.via.int64 > SIRIDB_TIME_NANOSECONDS)
{
- READ_DB_EXIT_WITH_ERROR("cannot read time-precision.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read time-precision.")
}
/* bind time precision to SiriDB */
siridb_time_new((siridb_timep_t) qp_obj.via.int64);
if ((*siridb)->time == NULL)
{
- READ_DB_EXIT_WITH_ERROR("cannot create time instance.")
+ READ_DB_EXIT_WITH_ERROR("Cannot create time instance.")
}
/* read buffer size, same buffer_size requirements are used in request.c */
qp_obj.via.int64 % 512 ||
qp_obj.via.int64 < 512)
{
- READ_DB_EXIT_WITH_ERROR("cannot read buffer size.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read buffer size.")
}
/* bind buffer size and len to SiriDB */
/* read number duration */
if (qp_next(unpacker, &qp_obj) != QP_INT64)
{
- READ_DB_EXIT_WITH_ERROR("cannot read number duration.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read number duration.")
}
/* bind number duration to SiriDB */
/* read log duration */
if (qp_next(unpacker, &qp_obj) != QP_INT64)
{
- READ_DB_EXIT_WITH_ERROR("cannot read log duration.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read log duration.")
}
/* bind log duration to SiriDB */
/* read timezone */
if (qp_next(unpacker, &qp_obj) != QP_RAW)
{
- READ_DB_EXIT_WITH_ERROR("cannot read timezone.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read timezone.")
}
/* bind timezone to SiriDB */
if (tzname == NULL)
{
- READ_DB_EXIT_WITH_ERROR("cannot allocate timezone name.")
+ READ_DB_EXIT_WITH_ERROR("Cannot allocate timezone name.")
}
if (((*siridb)->tz = iso8601_tz(tzname)) < 0)
{
log_critical("Unknown timezone found: '%s'.", tzname);
free(tzname);
- READ_DB_EXIT_WITH_ERROR("cannot read timezone.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read timezone.")
}
free(tzname);
if (qp_next(unpacker, &qp_obj) != QP_DOUBLE ||
qp_obj.via.real < 0.0 || qp_obj.via.real > 1.0)
{
- READ_DB_EXIT_WITH_ERROR("cannot read drop threshold.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read drop threshold.")
}
(*siridb)->drop_threshold = qp_obj.via.real;
/* read select points limit */
if (qp_next(unpacker, &qp_obj) != QP_INT64 || qp_obj.via.int64 < 1)
{
- READ_DB_EXIT_WITH_ERROR("cannot read select points limit.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read select points limit.")
}
(*siridb)->select_points_limit = qp_obj.via.int64;
/* read list limit */
if (qp_next(unpacker, &qp_obj) != QP_INT64 || qp_obj.via.int64 < 1)
{
- READ_DB_EXIT_WITH_ERROR("cannot read list limit.")
+ READ_DB_EXIT_WITH_ERROR("Cannot read list limit.")
}
(*siridb)->list_limit = qp_obj.via.int64;
}